package org.example.JUC.waitTest;

import java.util.concurrent.CountDownLatch;

/**
 * @description:
 * @author: farprt
 * @create: 2022-04-25 22:22
 **/
public class useCountDownLatch extends Thread{

    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch=new CountDownLatch(4);


        for (int i = 0; i < 4; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName());
                countDownLatch.countDown();
            },i+"").start();
        }

        countDownLatch.await();
        System.out.println("end");

    }
}